//
//  ByDocumentaryContentView.m
//  caipiao_ios
//
//  Created by mc on 2018/8/17.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "ByDocumentaryContentView.h"




@implementation ByDocumentaryContentView

- (id)init{
    self = [super init];
    if (self) {
        
        UIView *grayView = [[UIView alloc] init];
        [self addSubview:grayView];
        [grayView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(15);
            make.right.equalTo(self).offset(-15);
            make.top.equalTo(self).offset(15);
            make.bottom.equalTo(self).offset(-15);
        }];
        grayView.backgroundColor = rgba(255, 248, 249, 1);
        grayView.layer.borderColor = BY_LINE_COLOR.CGColor;
        grayView.layer.borderWidth = 1;
        
        UIImageView *ballView = [[UIImageView alloc] init];
        [self addSubview:ballView];
        [ballView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(10);
            make.top.equalTo(self).offset(5);
            make.size.mas_equalTo(CGSizeMake(22, 22));
        }];
        ballView.image = [UIImage imageNamed:@"zuqiu足球"];
        
        UILabel *titleLabel = [[UILabel alloc] init];
        [grayView addSubview:titleLabel];
        [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(grayView).offset(22);
            make.top.equalTo(grayView).offset(13);
            make.width.mas_equalTo(@120);
            make.height.mas_equalTo(@15);
        }];
        titleLabel.font = FONT(13);
        titleLabel.textColor = [UIColor brownColor];
        titleLabel.text = @"竞彩足球";
        self.titleLabel = titleLabel;
        
        UILabel *wayLabel = [[UILabel alloc] init];
        [grayView addSubview:wayLabel];
        [wayLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(grayView).offset(-17);
            make.top.equalTo(titleLabel.mas_top).offset(0);
            make.height.mas_equalTo(@15);
            make.left.equalTo(titleLabel.mas_right).offset(10);
        }];
        wayLabel.font = FONT(13);
        wayLabel.textColor  = BY_THEME_COLOR;
        wayLabel.text = @"2串1";
        wayLabel.hidden = YES;
        wayLabel.textAlignment = NSTextAlignmentRight;
        self.wayLabel = wayLabel;
        
        
        
        CGFloat width = (SCREEN_WIDTH - 12 - 30) / 4.0;
        
        ByDocumentaryContentTitleValue *titleValue1 = [[ByDocumentaryContentTitleValue alloc] init];
        [grayView addSubview:titleValue1];
        [titleValue1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(grayView).offset(0);
            make.bottom.equalTo(grayView).offset(0);
            make.size.mas_equalTo(CGSizeMake(width, 70));
        }];
        titleValue1.titleLabel.text = @"玩法";
        titleValue1.valueLabel.text = @"让球胜平负";
        
        ByDocumentaryContentTitleValue *titleValue2 = [[ByDocumentaryContentTitleValue alloc] init];
        [grayView addSubview:titleValue2];
        [titleValue2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(grayView).offset(width);
            make.bottom.equalTo(grayView).offset(0);
            make.size.mas_equalTo(CGSizeMake(width, 70));
        }];
        titleValue2.titleLabel.text = @"单倍金额";
        titleValue2.valueLabel.text = @"2元";
        
        ByDocumentaryContentTitleValue *titleValue3 = [[ByDocumentaryContentTitleValue alloc] init];
        [grayView addSubview:titleValue3];
        [titleValue3 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(grayView).offset(-width);
            make.bottom.equalTo(grayView).offset(0);
            make.size.mas_equalTo(CGSizeMake(width, 70));
        }];
        titleValue3.titleLabel.text = @"过关方式";
        titleValue3.valueLabel.text = @"2串1";
        
        ByDocumentaryContentTitleValue *titleValue4 = [[ByDocumentaryContentTitleValue alloc] init];
        [grayView addSubview:titleValue4];
        [titleValue4 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(grayView).offset(0);
            make.bottom.equalTo(grayView).offset(0);
            make.size.mas_equalTo(CGSizeMake(width, 70));
        }];
        titleValue4.titleLabel.text = @"佣金比例";
        titleValue4.valueLabel.text = @"5%";
        
        self.titleValue1 = titleValue1;
        self.titleValue2 = titleValue2;
        self.titleValue3 = titleValue3;
        self.titleValue4 = titleValue4;
        
        
        ByDottedLineView *line = [[ByDottedLineView alloc] init];
        line.direction = DottedLineViewDirectionHorizontalFromRight;
        line.lineColor = BY_LINE_COLOR;
        line.lengthPattern = @[@4, @3];
        [self addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(0);
            make.right.equalTo(self).offset(0);
            make.bottom.equalTo(self).offset(0);
            make.height.mas_equalTo(@1);
        }];
        self.line = line;
        
        UILabel *centerLine = [[UILabel alloc] init];
        [grayView addSubview:centerLine];
        [centerLine mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(grayView).offset(0);
            make.right.equalTo(grayView).offset(0);
            make.bottom.equalTo(grayView).offset(-35);
            make.height.mas_equalTo(@1);
        }];
        centerLine.backgroundColor = BY_LINE_COLOR;
        
        UILabel *centerLine1 = [[UILabel alloc] init];
        [grayView addSubview:centerLine1];
        [centerLine1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(grayView).offset(0);
            make.right.equalTo(grayView).offset(0);
            make.bottom.equalTo(grayView).offset(-70);
            make.height.mas_equalTo(@1);
        }];
        centerLine1.backgroundColor = BY_LINE_COLOR;
        
        
        for (int i = 1; i < 4; i++) {
            UILabel *line = [[UILabel alloc] init];
            [grayView addSubview:line];
            [line mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(grayView).offset(width * i);
                make.bottom.equalTo(grayView).offset(0);
                make.size.mas_equalTo(CGSizeMake(1, 70));
            }];
            line.backgroundColor = BY_LINE_COLOR;
        }
        
        
        
        
    }
    return self;
}




@end
